LearningStoreJob.DeleteItem Method

Delete an item

Parent Type: LearningStoreJob

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public void DeleteItem (
LearningStoreItemIdentifier id

)

Parameters

id

Identifies the item to be deleted

Exceptions
Exception type Condition
ArgumentNullException

id is a null reference.

Microsoft.LearningComponents.Storage.LearningStoreItemNotFoundException

The item was not found in the store.

Remarks

Steps required to delete an item from the store:

  1. Create a LearningStoreItemIdentifier identifying the item, either by calling the LearningStoreItemIdentifier constructor or by retrieving the value from elsewhere.
  2. Call this method to add the "delete item" operation to the job.
  3. Execute the job.

This operation does not return anything as a result.

If other items reference id, and id is marked as the "container" of those items, then the other items are also deleted.

Example

The following code deletes the user with an Id of 50 from the store.

C#
// Create the Id
LearningStoreItemIdentifier id = new LearningStoreItemIdentifier("UserItem", 50);
 
// Create the job and add the "delete item" operation
LearningStoreJob job = store.CreateJob();
job.DeleteItem(id);
 
// Execute the job
job.Execute();